package com.xunyin.modules.mtopencity.rest;

import com.xunyin.api.ApiResult;
import com.xunyin.modules.log.AppLog;
import com.xunyin.modules.mtopencity.service.mapper.MtOpenCityMapper;
import com.xunyin.modules.mtopencity.service.vo.OpenCityVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 开通城市接口controller
 * <p>
 * Created by xunyin
 * CopyRight 讯音云商 https://www.tonetn.com
 */
@Slf4j
@RestController
@Api(value = "开通城市接口相关", tags = "共享空间:开通城市接口相关")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CientOpenCityController {

    private final MtOpenCityMapper mtOpenCityMapper;

    /**
     * 获取开通城市接口
     */
    @AppLog(value = "获取开通城市接口", type = 1)
    //@AuthCheck
    @PostMapping("/city/opencity")
    @ApiOperation(value = "获取开通城市接口", notes = "获取开通城市接口")
    public ApiResult<List<OpenCityVo>> getOpenCity(@Validated @RequestBody Map<String, Object> param) {

        List<OpenCityVo> openCityList = mtOpenCityMapper.getOpenCityList();
        return ApiResult.ok(openCityList);
    }
}
